﻿using System.Configuration;
using FancyIdea.PingShui.Core.DbHelper;

namespace FancyIdea.PingShui.Core.Dal
{
    public class OracleCmd : OracleCommandWrapper
    {
        public OracleCmd()
        {
        }

        public OracleCmd(OracleCmd parent)
            : base(parent)
        {
        }
        private static string connectionString;
        private static readonly object connectionStringLock = new object();
        public static string GetConnectionString()
        {
            lock (connectionStringLock)
            {
                if (connectionString != null)
                {
                    return connectionString;
                }
            }

            ReloadConnectionString();
            return connectionString;
        }

        public static void ReloadConnectionString()
        {
            lock (connectionStringLock)
            {
                connectionString = ConfigurationManager.
                    ConnectionStrings["url"].ConnectionString;
            }
        }

        public override string ConnectionString
        {
            get
            {
                return GetConnectionString();
            }
        }
    }
}